﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace LabTurtorial
{
    public partial class Lab02Animal : Form
    {
        public Lab02Animal()
        {
            InitializeComponent();
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string text = cbbPicture.SelectedItem.ToString().ToLower();
            switch (text)
            {
                case "dog":
                    pictureBox1.Image = Image.FromFile("dog.png");
                    txtVoice.Text = "Go Go";
                    txtrDescription.Text = "Happy And Funny Dog";
                    break;
                case "cat":
                    pictureBox1.Image = Image.FromFile("cat.jpg");
                    txtVoice.Text = "Meo Meo";
                    txtrDescription.Text = "Happy And Funny Cat";
                    break;
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Stream stream;
            OpenFileDialog openDialog = new OpenFileDialog();
            if (openDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                stream = openDialog.OpenFile();
                if (stream != null)
                {
                    string filename = openDialog.FileName;
                    pictureBox1.Image = Image.FromFile(filename);
                }
            }
        }

        
    }
}
